package cn.wolfcode.wolf2w.business.api.factory;

import cn.wolfcode.wolf2w.business.api.RemoteUserEsService;
import cn.wolfcode.wolf2w.business.api.domain.StrategyES;
import cn.wolfcode.wolf2w.business.api.domain.UserES;
import cn.wolfcode.wolf2w.common.core.domain.R;
import org.apache.commons.compress.utils.Lists;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteUserEsFallbackFactory implements FallbackFactory<RemoteUserEsService> {
    @Override
    public RemoteUserEsService create(Throwable throwable) {
        return new RemoteUserEsService(){


            @Override
            public R<?> initUserEs(UserES userES, String source) {
                return  R.fail(Lists.newArrayList(), "初始化用户ES数据失败:" + throwable.getMessage());
            }
        };
    }
}
